home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / lang / sofa.lha / sofa / smalleiffel / lib_se / abstract_current.e next >
Text File  |  2000-03-25  |  6KB  |  247 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  4. --                       http://SmallEiffel.loria.fr
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
  11. -- for  more  details.  You  should  have  received a copy of the GNU General
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. deferred class ABSTRACT_CURRENT
  17.    --
  18.    -- Handling of the pseudo variable "Current".
  19.    --
  20.  
  21. inherit EXPRESSION;
  22.  
  23. feature
  24.  
  25.    start_position: POSITION;
  26.  
  27.    result_type: TYPE;
  28.          -- Non Void when checked;
  29.  
  30.    is_current: BOOLEAN is true;
  31.  
  32.    is_writable: BOOLEAN is false;
  33.  
  34.    is_manifest_string: BOOLEAN is false;
  35.  
  36.    is_manifest_array: BOOLEAN is false;
  37.  
  38.    is_static: BOOLEAN is false;
  39.  
  40.    is_pre_computable: BOOLEAN is false;
  41.  
  42.    is_result: BOOLEAN is false;
  43.  
  44.    is_void: BOOLEAN is false;
  45.  
  46.    can_be_dropped: BOOLEAN is true;
  47.  
  48.    c_simple: BOOLEAN is true;
  49.  
  50.    use_current: BOOLEAN is true;
  51.  
  52.    isa_dca_inline_argument: INTEGER is 0;
  53.  
  54.    static_result_base_class: BASE_CLASS is
  55.       do
  56.          Result := start_position.base_class;
  57.       end;
  58.  
  59.    to_string, to_key: STRING is
  60.       do
  61.          Result := as_current;
  62.       end;
  63.  
  64.    frozen static_value: INTEGER is
  65.       do
  66.       end;
  67.  
  68.    frozen assertion_check(tag: CHARACTER) is
  69.       do
  70.       end;
  71.  
  72.    frozen afd_check is
  73.       do
  74.       end;
  75.  
  76.    frozen dca_inline_argument(formal_arg_type: TYPE) is
  77.       do
  78.       end;
  79.  
  80.    frozen mapping_c_target(target_type: TYPE) is
  81.       local
  82.          flag: BOOLEAN;
  83.       do
  84.          if is_written then
  85.             flag := cpp.call_invariant_start(target_type);
  86.          end;
  87.          cpp.print_current;
  88.          if flag then
  89.             cpp.call_invariant_end;
  90.          end;
  91.       end;
  92.  
  93.    frozen mapping_c_arg(formal_arg_type: TYPE) is
  94.       local
  95.          rt: like result_type;
  96.       do
  97.          rt := result_type.run_type;
  98.          if rt.is_reference then
  99.             if formal_arg_type.is_reference then
  100.                -- Reference into Reference :
  101.                cpp.put_string(fz_cast_t0_star);
  102.                cpp.print_current;
  103.             else
  104.                -- Reference into Expanded :
  105.                cpp.print_current;
  106.             end;
  107.          elseif formal_arg_type.is_reference then
  108.             -- Expanded into Reference :
  109.             cpp.print_current;
  110.          elseif rt.is_user_expanded then
  111.             -- User Expanded into User Expanded :
  112.             if not rt.is_dummy_expanded then
  113.                cpp.put_character('*');
  114.             end;
  115.             cpp.print_current;
  116.          else
  117.             -- Kernel Expanded into Kernel Expanded :
  118.             cpp.print_current;
  119.          end;
  120.       end;
  121.  
  122.    frozen c_declare_for_old is
  123.       do
  124.       end;
  125.  
  126.    frozen compile_to_c_old is
  127.       do
  128.       end;
  129.  
  130.    frozen compile_to_jvm_old is
  131.       do
  132.       end;
  133.  
  134.    frozen collect_c_tmp is
  135.       do
  136.       end;
  137.  
  138.    frozen compile_to_c is
  139.       do
  140.          if result_type.is_user_expanded then
  141.             cpp.put_character('*');
  142.          end;
  143.          cpp.print_current;
  144.       end;
  145.  
  146.    frozen compile_to_jvm is
  147.       do
  148.          result_type.jvm_push_local(0);
  149.       end;
  150.  
  151.    frozen compile_target_to_jvm is
  152.       do
  153.          if is_written then
  154.             standard_compile_target_to_jvm;
  155.          else
  156.             compile_to_jvm;
  157.          end;
  158.       end;
  159.  
  160.    frozen jvm_branch_if_false: INTEGER is
  161.       do
  162.          compile_to_jvm;
  163.          Result := code_attribute.opcode_ifeq;
  164.       end;
  165.  
  166.    frozen jvm_branch_if_true: INTEGER is
  167.       do
  168.          compile_to_jvm;
  169.          Result := code_attribute.opcode_ifne;
  170.       end;
  171.  
  172.    frozen compile_to_jvm_into(dest: TYPE): INTEGER is
  173.       do
  174.          Result := standard_compile_to_jvm_into(dest);
  175.       end;
  176.  
  177.    frozen to_runnable(ct: TYPE): like Current is
  178.       do
  179.          if result_type = Void then
  180.             result_type := ct;
  181.             Result := Current
  182.          elseif result_type = ct then
  183.             Result := Current
  184.          else
  185.             !!Result.make(start_position);
  186.             Result := Result.to_runnable(ct);
  187.          end;
  188.       end;
  189.  
  190.    frozen stupid_switch(r: ARRAY[RUN_CLASS]): BOOLEAN is
  191.       do
  192.       end;
  193.  
  194.    frozen precedence: INTEGER is
  195.       do
  196.          Result := atomic_precedence;
  197.       end;
  198.  
  199.    frozen bracketed_pretty_print, frozen pretty_print is
  200.       do
  201.          fmt.put_string(as_current);
  202.       end;
  203.  
  204.    frozen print_as_target is
  205.       do
  206.          if is_written or else fmt.print_current then
  207.             fmt.put_string(as_current);
  208.             fmt.put_character('.');
  209.          end;
  210.       end;
  211.  
  212.    frozen short is
  213.       do
  214.          short_print.hook_or(as_current,as_current);
  215.       end;
  216.  
  217.    frozen short_target is
  218.       do
  219.          if is_written then
  220.             short;
  221.             short_print.a_dot;
  222.          end;
  223.       end;
  224.  
  225.    frozen jvm_assign is
  226.       do
  227.       end;
  228.  
  229. feature {NONE}
  230.  
  231.    is_written: BOOLEAN is
  232.          -- True when it is a really written Current.
  233.       deferred
  234.       end;
  235.  
  236.    make(sp: like start_position) is
  237.       require
  238.          not sp.is_unknown
  239.       do
  240.          start_position := sp;
  241.       ensure
  242.          start_position = sp
  243.       end;
  244.  
  245. end -- ABSTRACT_CURRENT
  246.  
  247.